Skip to content

[build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC#6422

Open
AlrIsmail wants to merge 1 commit intoPointCloudLibrary:masterfrom
AlrIsmail:fix-msvc-cplusplus-reporting
Open

[build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC#6422
AlrIsmail wants to merge 1 commit intoPointCloudLibrary:masterfrom
AlrIsmail:fix-msvc-cplusplus-reporting

Conversation

@AlrIsmail
Copy link
Copy Markdown

Fixes #3494.

This PR adds the /Zc:__cplusplus compiler flag when building with MSVC 15.7 or newer to ensure the __cplusplus macro correctly reports the C++ standard version.

Key Changes:

  • Appended /Zc:__cplusplus to global CMAKE_CXX_FLAGS for MSVC 15.7+.
  • Added PCLCONFIG_COMPILE_OPTIONS to pcl_pclconfig.cmake for storing/exporting compile options.
  • Updated PCLConfig.cmake.in so downstream projects inherit the flag.

Verification: Verified CMake logic via mock tests for older and newer MSVC versions, ensuring alignment with existing PCL build patterns.

@AlrIsmail AlrIsmail changed the title [build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC (#3494) [build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add /Zc:__cplusplus switch to fix __cplusplus on MSVC

1 participant